/**
 * @file: paddleocr_post_process.h
 * @author: sdk team
 * @brief
 * @version: 1.0
 * @date 2022-10-09
 *
 * Copyright:
 * © 2018 北京灵汐科技有限公司 版权所有。
 * 注意：以下内容均为北京灵汐科技有限公司原创，未经本公司允许，不得转载，否则将视为侵权；对于不遵守此声明或者其他违法使用以下内容者，本公司依法保留追究权。
 * © 2018 Lynxi Technologies Co., Ltd. All rights reserved.
 * NOTICE: All information contained here is, and remains the property of Lynxi.
 * This file can not be copied or distributed without the permission of Lynxi
 * Technologies Co., Ltd.
 */
#ifndef __PADDLE_OCR_POST_PROCESS_H__
#define __PADDLE_OCR_POST_PROCESS_H__

#include "boxInfo.h"

#ifdef __cplusplus
extern "C" {
#endif

namespace ocr {

typedef struct {
  int w;
  int h;
} imageInfo;

typedef struct {
  imageInfo images[BOX_MAX_NUM];
} cropImagesInfo;

typedef struct {
  int num;
  char data[5];
} mKey;

typedef struct {
  int num;
  mKey data[7000];
} mKeys;

typedef struct {
  int img_height;
  int img_width;
  int m_height;
  int m_width;
  void *output_tensor;
  lynBoxesInfo *boxesInfo; // 输出box信息, Lynxi plugin方式时需要使用device
                           // memory传递，否则使用系统内存
  void *image_data;
  void *crop_images_data;
  cropImagesInfo *cropsInfo;
} PaddleOcrDetectPostProcessInfo_t;

typedef struct {
  int boxIndex;
  int m_height;
  int m_width;
  mKeys *mkeys;
  void *output_tensor;
  lynBoxesInfo *boxesInfo;
} PaddleOcrRecogPostProcessInfo_t;

int lynPaddleOcrDetectPostProcess(PaddleOcrDetectPostProcessInfo_t *post_info);

int lynPaddleOcrRecogPostProcess(PaddleOcrRecogPostProcessInfo_t *post_info);

} // namespace ocr

#ifdef __cplusplus
}
#endif

#endif